﻿using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

using SBPweb.RIA.Client.Controls.Windows;

using SBPweb.PROvibe.Client.Library.Base;

namespace SBPweb.PROvibe.Client.Core.Controls
{

    public partial class PowerButton : UserControlBase
    {

        #region Constructor logic

        public PowerButton()
        {
            InitializeComponent();
        }

        #endregion

        #region Methods
        
        #endregion

        #region Event handlers
        
        private void Button_Loaded(object sender, RoutedEventArgs e)
        {
            VisualStateManager.GoToState(sender as Control, "Normal", false);
        }

        private void Button_MouseEnter(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(sender as Control, "MouseOver", true);
        }

        private void Button_MouseLeave(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(sender as Control, "Normal", true);
        }

        private void ToolBarItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //if (Application.IsRunningOutOfBrowser)
            //{
            //    ShowCloseConfirmationWindow();
            //}
            //else
            //{
                Grid grdRoot = Parent as Grid;
                PageManager pageManager = grdRoot.Parent as PageManager;
                if (pageManager != null)
                {
                    pageManager.ShowCloseConfirmationWindow();
                }
            //}
        }

        #endregion

    }

}